<?php

/**
 * This is the model class for table "company_meta".
 *
 * The followings are the available columns in table 'company_meta':
 * @property integer $id
 * @property integer $company_id
 * @property string $boshu
 * @property string $work_area
 * @property string $salary
 * @property string $work_con
 * @property string $apply_con
 * @property string $motome_hito
 * @property string $skill
 * @property string $url
 * @property string $work_content
 * @property string $establishment
 */
class CompanyMeta extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return CompanyMeta the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'company_meta';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('company_id', 'required'),
			array('company_id', 'numerical', 'integerOnly'=>true),
			array('work_area', 'length', 'max'=>100),
			array('url, establishment', 'length', 'max'=>50),
			array('boshu, salary, work_con, apply_con, motome_hito, skill, work_content', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, company_id, boshu, work_area, salary, work_con, apply_con, motome_hito, skill, url, work_content, establishment', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'company_id' => 'Company',
			'boshu' => 'Boshu',
			'work_area' => 'Work Area',
			'salary' => 'Salary',
			'work_con' => 'Work Con',
			'apply_con' => 'Apply Con',
			'motome_hito' => 'Motome Hito',
			'skill' => 'Skill',
			'url' => 'Url',
			'work_content' => 'Work Content',
			'establishment' => 'Establishment',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('company_id',$this->company_id);
		$criteria->compare('boshu',$this->boshu,true);
		$criteria->compare('work_area',$this->work_area,true);
		$criteria->compare('salary',$this->salary,true);
		$criteria->compare('work_con',$this->work_con,true);
		$criteria->compare('apply_con',$this->apply_con,true);
		$criteria->compare('motome_hito',$this->motome_hito,true);
		$criteria->compare('skill',$this->skill,true);
		$criteria->compare('url',$this->url,true);
		$criteria->compare('work_content',$this->work_content,true);
		$criteria->compare('establishment',$this->establishment,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}